﻿<html class="hb-loaded">
<head>
    <meta charset="utf-8">
    <title>会员注册</title>
    <meta name="Keywords" content="Darry Ring钻戒价格,Darry Ring钻戒图片">
    <meta name="Description"
          content="Darry Ring官网会员注册登录唯一入口，Darry Ring是求婚钻戒第一品牌，想了解Darry Ring实体店、Darry Ring哪里有卖等相关Darry Ring资讯就先进入戴瑞珠宝官网注册吧！">
    <link href="css/style.css" type="text/css" rel="stylesheet"/>
</head>

<body>
<div class="wrap">
    <!-- start of 头部导航-->
    <div class="head_top">
        <div class="head clearfix">
            <!--头部左边-->
            <div class="topLeft left">
                <a href="../templates/index.html" title="Darry Ring">
                    <img width="186" height="42" src="images/logo_01.png ">
                </a>
                <span>求婚钻戒领导品牌</span>
            </div>
            <!--头部左边end-->
            <!--头部右边-->
            <ul class="topRight right">
                <li>国际权威认证</li>
                <li class="tr_2">15天无理由退换</li>
                <li class="tr_3">终身保养</li>
            </ul>
            <!--头部左边end-->
        </div>
    </div>
    <!--end of 头部导航-->
    <!-- starto of container -->
    <div class="container">
        <!--中间内容-->
        <div class="cmain ddd">
            <!--内容右边-->
            <div class="cort-right right">
                <div class="r_bg"></div>
                <!--登陆框内-->
                <div class="cr_border">
                    <div class="tits">
                        <span class="focus ph"><em></em>邮箱注册</span>
                        <!--                        <span class=" em"><em></em>邮箱注册</span>-->
                    </div>
                    <!--手机注册-->
                    <form method="post" action="/sign" class="form_first">
                        <input type="hidden" value="1" name="type">
                        <input type="hidden" value="login.html" name="forward">
                        <input type="hidden" value="H6mY5VyS" name="skey">
                        <div style="" class="photo_show">
                            <div class="the_input">
                                <span class="member"></span>
                                <input type="text" placeholder="请输入邮箱地址" class="al_Input dr_photo" value=""
                                       name="email" id="email">
                            </div>
                            <!--密码-->
                            <div style="border:none" class="the_input">
                                <span class="password"></span>
                                <input type="text" style="width:133px;" placeholder="请输入验证码" class="al_Input ls"
                                       value="" name="mobile_code" id="mobile_code">
                                <input type="button" value="获取验证码" class="action mobile_action">
                            </div>

                            <!--验证码end-->
                            <!--密码-->
                            <div class="the_input ">
                                <span class="pw"></span>
                                <input type="password" placeholder="请输入密码" maxlength="21" class="al_Input dr_photo"
                                       value="" name="mobile_pwd" id="mobile_pwd">
                            </div>
                            <!--密码end-->
                            <!--密码-->
                            <div class="the_input ">
                                <span class="pw"></span>
                                <input type="password" placeholder="确认密码" maxlength="21" class="al_Input dr_photo"
                                       value="" name="mobile_pwd_confirm" id="mobile_pwd_confirm">
                            </div>
                            <!--密码end-->

                            <div class="other_input">
                                <div class="left">
                                    <input type="checkbox" name="mobile_check" id="check">
                                    <label for="check">已经仔细阅读并同意<a target="_blank" href="../templates/index.html/help_se/49.html">《Darry
                                        Ring用户注册协议》</a></label>
                                </div>
                            </div>

                            <!--其他合作-->
                            <div class="other_hz">
                                <input type="button" value="立即注册" id="mobile_reg" class="up">
                            </div>
                            <!--其他合作end-->
                        </div>
                    </form>
                    <!--手机注册end-->


                    <div><span
                            style="font-size: 12px; display: inline-block;padding-top: 10px;float:left;margin-left: 176px; ">已经有账号，</span><span
                            style="color: #8e4f1b; font-size: 12px; display: inline-block; float: right; margin-right: 42px; padding-top: 10px;"><a
                            href="login.html">立即登录</a></span></div>
                    <!--邮箱注册end-->
                </div>
                <!--登陆框内end-->
            </div>
            <!--内容右边end-->
        </div>
        <!--中间内容end-->
    </div>
    <!-- end of container -->

    <!--底部end-->
    <div class="cmain bc_yz">
        <div class="db_cort">
            <p>Copyright &copy; 2006-2015 www.darryring.com 戴瑞珠宝 All Rights Reserved. 粤ICP备11012085号</p>
            <p>中国互联网违法信息举报中心 | 中国公安网络110报警服务 | 本网站提供所售商品的正式发票</p>
        </div>
    </div>

    <script src="js/jquery.js" type="text/javascript"></script>
    <script src="layer/layer.js"></script>
    <script type="text/javascript">
        let InterValObj; //timer变量，控制时间
        let curCount = 15;//当前剩余秒数
        function isNull(str) {
            return str === '';
        }

        function SetRemainTime() {
            if (curCount == 0) {
                window.clearInterval(InterValObj);//停止计时器
                $(".mobile_action").removeAttr("disabled");//启用按钮
                $(".mobile_action").val("获取验证码");
                code = ""; //清除验证码。如果不清除，过时间后，输入收到的验证码依然有效
            } else {
                curCount--;
                $(".mobile_action").val(curCount + "秒后可重新获取验证码");
            }
        }

        let my_reg = /^([\.a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(\.[a-zA-Z0-9_-])+/;

        function isEmail(email) {
            return my_reg.test(email);
        }

        $(function () {
            //验证参数
            $('.up').click(function () {
                $('.ts_wrong').remove();
                $('.al_Input').removeClass('error');
                //判断是邮箱还是手机
                //邮箱登录
                let email = $('#email').val();
                if (isNull(email)) {
                    let notice = '<div class="ts_wrong"><span id="wrong">请输入邮箱！</span></div>';
                    $('input[name="email"]').parent().after(notice);
                    $('input[name="email"]').addClass('error');
                    return false;
                }

                if (!isEmail(email)) {
                    let notice = '<div class="ts_wrong"><span id="wrong">邮箱格式错误 请重新输入！</span></div>';
                    $('input[name="email"]').parent().after(notice);
                    $('input[name="email"]').addClass('error');
                    return false;
                }

                let pwd = $('#mobile_pwd').val();

                if (isNull(pwd)) {
                    console.log("ok");
                    let notice = '<div class="ts_wrong"><span id="wrong">请输入密码！</span></div>';
                    $('input[name="mobile_pwd"]').parent().after(notice);
                    $('input[name="mobile_pwd"]').addClass('error');
                    return false;
                }

                if (pwd.length < 6) {
                    let notice = '<div class="ts_wrong"><span id="wrong">密码长度为6~21个字符！</span></div>';
                    $('input[name="mobile_pwd"]').parent().after(notice);
                    $('input[name="mobile_pwd"]').addClass('error');
                    return false;
                }

                var pwd_confirm = $('#mobile_pwd_confirm').val();
                if (isNull(pwd_confirm)) {
                    let notice = '<div class="ts_wrong"><span id="wrong">请输入确认密码！</span></div>';
                    $('input[name="mobile_pwd_confirm"]').parent().after(notice);
                    $('input[name="mobile_pwd_confirm"]').addClass('error');
                    return false;
                }

                if (pwd != pwd_confirm) {
                    let notice = '<div class="ts_wrong"><span id="wrong">密码与确认密码不一致 请重新输入！</span></div>';
                    $('input[name="mobile_pwd_confirm"]').parent().after(notice);
                    $('input[name="mobile_pwd_confirm"]').addClass('error');
                    return false;
                }

                let code = $('#mobile_code').val();
                if (isNull(code)) {
                    let notice = '<div class="ts_wrong"><span id="wrong">请输入验证码！</span></div>';
                    $('input[name="mobile_code"]').parent().after(notice);
                    $('input[name="mobile_code"]').addClass('error');
                    return false;
                }

                if (!$('input[name="mobile_check"]').is(':checked')) {
                    var notice = '<div class="ts_wrong"><span id="wrong">请阅读并同意用户注册协议！</span></div>';
                    $('input[name="mobile_check"]').parent().parent().after(notice);
                    return false;
                }
                $.post("/dr_mall/drUser/register",{
                    account:email,
                    password:pwd,
                    vCode:code
                },function (r){
                    if(r.code===200){
                        location.href="login.html";
                    }else if(r.code===605){
                        layer.msg("验证码错误",{
                            icon:2,
                            time:1000
                        });
                    }
                });
            });

            //发送验证码
            $('.mobile_action').click(function () {
                $('.ts_wrong').remove();
                $('.al_Input').removeClass('error');
                let email = $('#email').val();
                console.log(email);
                if (isNull(email)) {
                    let notice = '<div class="ts_wrong"><span id="wrong">请输入邮箱！</span></div>';
                    $('input[name="email"]').parent().after(notice);
                    $('input[name="email"]').addClass('error');
                    return false;
                }
                if (!isEmail(email)) {
                    let notice = '<div class="ts_wrong"><span id="wrong">邮箱格式错误 请重新输入！</span></div>';
                    $('input[name="email"]').parent().after(notice);
                    $('input[name="email"]').addClass('error');
                    return false;
                }
                curCount = 15;
                $.post("/dr_mall/drUser/send_email", {email: email}, function (r) {
                    if (r.code === 200) {
                        layer.msg("发送成功",{
                            icon:1,
                            time:1000
                        });
                    }else if(r.code===604){
                        layer.msg("该邮箱已注册",{
                            icon:2,
                            time:1000
                        });
                    }
                });
                $(".mobile_action").attr('disabled', 'disabled');
                InterValObj = window.setInterval("SetRemainTime()", 1000);
            });
        });
    </script>
</div>>
</body>
</html>